// 全局过滤器
import { toDecimalNoZero } from './index'

const filterAmount = val => {
  if (val === '' || val === null || val === undefined) {
    return ''
  } else {
    return Number(toDecimalNoZero(val, 8)).toFixed(8).replace(/\.0+$/, '').replace(/(\.\d+[1-9])0+$/, '$1')
  }
}

export { filterAmount }
